package com.cj.picturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cj.picturebackend.model.dto.user.UserQueryRequest;
import com.cj.picturebackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cj.picturebackend.model.vo.LoginUserVo;
import com.cj.picturebackend.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author chenjie
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-04-07 12:55:38
*/
public interface UserService extends IService<User> {


    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 获取加密密码
     * @param password
     * @return
     */
    String getEncryptPassword(String password);


    /**
     * 用户登录
     * @param userAccount
     * @param userPassword
     * @param request  登录成功设置cookie
     * @return 用户脱敏
     */
    public LoginUserVo userLogin(String userAccount, String userPassword, HttpServletRequest request);
    /**
     * 获取脱敏后的用户信息
     * @param user
     * @return
     */
    LoginUserVo getLoginUserVo(User user);

    /**
     * 获取脱敏后的用户信息
     * @param user
     * @return
     */
    UserVO getUserVo(User user);

    /**
     *  获取脱敏后的用户信息列表
     * @param userList
     * @return
     */
    List<UserVO> getUserVoList(List<User> userList);


    /**
     * 获取当前登录用户
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);


    /**
     * 用户登录注销
     * @param request
     */
    void userLogout(HttpServletRequest request);


    /**
     * 将查询条件 ，，变成 queryWrapper
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);
}
